/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package gro.administraciones.clases;

import gro.utilitarios.Conexiones;
import gro.utilitarios.Global;
import gro.utilitarios.Utilitarios;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.Connection;

/**
 *
 * @author AMT40B
 */


public class PacienteMD {
    PacienteDP padp;
    Conexiones cone;
        private Connection con;
    private Statement stmt;
    Utilitarios uti;
    public boolean cargarCodigoPacienteMD(PacienteDP padp) {
        this.padp = padp;
        try {
            if (cone.crearConexion()) {
                String sql1 = "SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA='"+Global.nombreBase+"' AND TABLE_NAME = 'Paciente'";
                Statement stmt = con.createStatement();
                ResultSet rs = stmt.executeQuery(sql1);
                while (rs.next()) {
                    padp.setCodigo(Integer.parseInt(rs.getString("auto_increment").toString()));
                }
                cone.desconectar();
                return true;
            }
            cone.desconectar();
            return false;
        } catch (Exception ex) {
            uti.mensaje(ex.toString(), this.getClass().toString());
            cone.desconectar();
            return false;
        }
    }//cargarCodigoPacienteMD
    
}
